package sequence;

import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class SequenceUtils {

	public static TimedSequence load(String name) throws FileNotFoundException {
		XMLDecoder decoder = new XMLDecoder(new FileInputStream("res/" + name
				+ ".seq"));
		TimedSequence seq = (TimedSequence) decoder.readObject();
		return seq;
	}

	public static void save(TimedSequence seq) throws IOException {
		XMLEncoder encoder = new XMLEncoder(new FileOutputStream("res/"
				+ seq.getName() + ".seq"));
		encoder.writeObject(seq);
		encoder.close();
	}
}
